import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        long a = in.nextInt(),h = in.nextInt(),b = in.nextInt(),k = in.nextInt();
        long n = Math.min(h/b,k/a);
        long count = (a + b) * n;
        h -= n * b;
        k -= n * a;
        if(h > 0 && k > 0){
            count += a + b;
            h -= b;
            k -= a;
        }
        if(h > 0 || k > 0){
            count += 10 * (h > 0 ? a : b);
        }
        System.out.println(count);
    }
}